//needs Jquery to be loaded before this method... //allowing jquery on ready script to execute only //when jquery is loaded in the content frame var GET_BROWSER_DYAMIC_TOOLTIP = false; //Add event to entire document rather than adding it to various elements document.addEventListener("click", function (event) { if (allowClose(event.target.className)) { parent.closePops(event); } parent.closeNavMenus(event); }); resolveTooltip(); function allowClose(elementClass) { if (elementClass === undefined) return true; var action = (elementClass.indexOf('user-info') > -1 || elementClass.indexOf('em-announcement') > -1 || elementClass.indexOf('custom-select') > -1) ? false : true; return action; } // * Though pageName and its title are already read in client side // * doing server side to handel any businees request like language pack, // * more user friendly tool tip etc... function resolveTooltip() { if (!GET_BROWSER_DYAMIC_TOOLTIP) return; var path = window.location.pathname; var page = path.split("/").pop(); var pathqualifier = path.indexOf('/admin/') > 0 ? '../' : ''; jQuery.ajax( { url: pathqualifier + 'DataHandlers/BrowserTabToolTipHandler.ashx?page=' + page + '&title=' + document.title, type: 'GET', timeout: 60000, contentType: 'application/json; charset=utf-8', dataType: 'json', cache: false } ).done(function (response) { parent.document.title = response; }); }